<%--
  ** Copyright(c) 2005 BroadVision, Inc. All rights reserved.
  **
  ** This software is copyrighted.  Under the copyright laws, this software
  ** may not be copied, in whole or in part, without prior written consent
  ** of BroadVision, Inc. or its assignees. This software is provided under
  ** the terms of a license between BroadVision and the recipient, and its
  ** use is subject to the terms of that license.
  **
  ** This software may be protected by one or more U.S. and International
  ** patents. Certain applications of BroadVision One-To-One software are
  ** covered by U.S. patent 5,710,887.
  **
  ** TRADEMARKS: BroadVision and the BroadVision logo are registered
  ** trademarks, and BroadVision One-To-One is a trademark of BroadVision,
  ** Inc. IONA and Orbix are trademarks of IONA Technologies, Ltd. RSA,
  ** MD5, and RC2 are trademarks of RSA Data Security, Inc. All other
  ** trademarks, service marks, and trade names belong to their respective
  ** owners. BroadVision, Inc. disclaims any proprietary interest in the
  ** marks and names of others.
  --%>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>

<%@ page import="com.broadvision.ssp.client.SelfServiceProcess" %>

<%@include file="/bp/report/runtimeReportConfigPreamble.jsp" %>

  <!-- ========================================================
    ** process
    -->
  <script language="Javascript">
  function deleteProcess(url)
  {
    var msg = '<bean-el:message key="bp.report.process.confirm.delete" bundle="bp.messages"/>';

    if (!confirm(msg))
      return false;

    location.replace(url);
    return true;
  }
  </script>
  <tr>
    <td valign="top" colspan="2">
      <div class="pageSubtitle">
        <span class="left">
          <bean-el:message
            key="bp.report.runtimeReportConfig.process.subtitle"
            bundle="bp.messages"
          />
        </span>
        <span class="right">&nbsp;</span>
      </div>

      <table class="dataTable" summary="runtime report process table"
             border="0" cellspacing="1" cellpadding="2" width="100%">
        <tr class="listHeader">
          <th id="Name:Process" align="left">
            <bean-el:message
              key="bp.report.runtimeReportConfig.process.header.name"
              bundle="bp.messages"
            />
          </th>
          <th id="Desc:Process" align="left">
            <bean-el:message
              key="bp.report.runtimeReportConfig.process.header.description"
              bundle="bp.messages"
            />
          </th>
          <th id="Actions:Process" align="left" nowrap>
            <bean-el:message key="header.actions" bundle="bp.messages"/>
          </th>
        </tr>

        <c:forEach var="ssp" items="${sspList}" varStatus="index">
          <c:choose>
            <c:when test="${!empty ssp}">
              <%
              // get around issue with ssp.client.ContentBasic not being
              // a public class
              SelfServiceProcess ssp =
                      (SelfServiceProcess)pageContext.getAttribute("ssp");
              pageContext.setAttribute("sspOid", new Long(ssp.getOid()));
              pageContext.setAttribute("sspSvc",
                                       new Integer(ssp.getServiceId()));
              pageContext.setAttribute("sspName", ssp.getName());
              pageContext.setAttribute("sspDesc", ssp.getDescription());
              %>
            </c:when>
            <c:otherwise>
              <!-- possibly defunct process model -->
              <c:set
                var="proc"
                value="${reportConfigProcModelList[index.count]}"
              />
              <c:set var="sspOid"  value="${proc.oid}"/>
              <c:set var="sspSvc"  value="${proc.service}"/>
              <c:set var="sspName">
                <bean-el:message
                  key="bp.report.process.nameNotAvailable"
                  bundle="bp.messages"
                />
              </c:set>
              <c:set var="sspDesc">
                <bean-el:message
                  key="bp.report.process.descNotAvailable"
                  bundle="bp.messages"
                />
              </c:set>
            </c:otherwise>
          </c:choose>

          <tr class="<c:out value="${listEvenOrOdd[(index.count+1)%2]}"/>">
            <td headers="Name:Process">
              <c:url var="editUrl" value="/bp/reportProcessEdit.do">
                <c:param name="procIndex" value="${index.count-1}"/>
              </c:url>
              <a href="<c:out value="${editUrl}" escapeXml="false"/>">
                <c:out value="${sspName}"/>
              </a>
            </td>
            <td headers="Desc:Process">
              <c:out value="${sspDesc}" escapeXml="false"/>
            </td>
            <td nowrap align="left" headers="Actions:Process">
              <a href="<c:out value="${editUrl}" escapeXml="false"/>">
                <c:out value="${editImg}" escapeXml="false"/>
              </a>
              <c:url var="delUrl" value="/bp/reportProcessDelete.do">
                <c:param name="procIndex" value="${index.count-1}"/>
              </c:url>
              <a href="#" onclick="deleteProcess('<c:out value="${delUrl}"/>')">
                <c:out value="${deleteImg}" escapeXml="false"/>
              </a>
            </td>
          </tr>
        </c:forEach>

        <form method="POST" action="<%=ctxPath%>/bp/reportAddProcessBrowse.do">
          <tr>
            <td headers="Name:Process" align="left">&nbsp;</td>
            <td headers="Desc:Process" align="left">&nbsp;</td>
            <td headers="Actions:Process" align="left" nowrap>
              <c:set var="addButtonValue">
                <bean-el:message key="button.add" bundle="bp.messages"/>
              </c:set>
              <input class="inputButton" type="SUBMIT" name="addBtn"
                      value="<c:out value="${addButtonValue}"/>">
            </td>
          </tr>
        </form>
      </table>
    </td>
  </tr>

<%@include file="/bp/report/runtimeReportConfigPostamble.jsp" %>

<!-- =============================================================
  ** vim: set ts=2 expandtab syntax=jsp:
  -->
